package com.aaa.sso.controller;

import com.aaa.common.util.Result;
import com.aaa.sso.service.AuthService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @fileName:MemberLoginController
 * @description:  cm  =check member 检查会员是否认证
 * @author:zhz
 * @createTime:2020/12/7 9:35
 * @version:1.0.0
 */
@RestController
@RequestMapping("userLogin")
public class UserLoginController {

    //@Resource(name = "memberAuthService")
    @Autowired
    @Qualifier("userAuthService")
    private AuthService authService;

    /**
     * 会员验证功能
     * @param userName
     * @param passWord
     * @return
     */
    @GetMapping("authUser")
    @ApiOperation ("会员验证")
    public Result  authUser(String userName,String  passWord){
        return authService.authMemberOrUser(userName,passWord);
    }

    /**
     * 登出
     * @param token
     * @return
     */
    @GetMapping("logout")
    @ApiOperation ("用户登出")
    public Result logout(@RequestParam("accessToken") String token){
        return authService.logout(token);
    }

    /**
     * 验证token
     * @param accessToken
     * @return
     */
    @GetMapping("chechAccessToken")
    @ApiOperation ("验证token")
    public boolean  chechAccessToken(@RequestParam("accessToken") String accessToken){
        return authService.chechAccessToken(accessToken);
    }

}
